// interface 接口使用示例
interface ST {
    name: string;
    age: number;
    score: number;
    phone?: number;//可选参数
    [propname:string]:any;//可以任意参数，不限个数和类型
}

const enrollment = (stud:ST):string => {
    let res = '';
    if (stud.age > 24 && stud.score>=90){
        res = '已录取'
    }else{
        res = '未录取'
    }
    return res
}

const getInfo = (stud:ST) => {
    console.log(`姓名:${stud.name}\n年龄:${stud.age}\n分数:${stud.score}\n录取:${enrollment(stud)}`)
    if (stud.phone) {
        console.log(`手机:${stud.phone}`);
    }
    if(stud.sex){
        console.log(`性别:${stud.sex}`);
    }
    if (stud.city) {
        console.log(`城市:${stud.city}`);
    }
}

const student = {
    name: '小花',
    age: 25,
    score: 90,
    sex: '女',
    city: '青岛',
    phone: 13288888888
}

getInfo(student);
